class Object

Public Instance Methods

chance(percent) click to toggle source

Returns true with a probability of 'percent'

# File lib/utils.rb, line 6
def chance(percent)
  rand(100) <= percent
end
hash_intern(h) click to toggle source

Intern the string keys to a hash

# File lib/utils.rb, line 12
def hash_intern(h)
  h.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }
end